package com.example.wj.dao;

import com.example.wj.dto.BookDto;
import com.example.wj.entity.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BookDao {

    Book queryById(Integer id);

    List<Book> queryAllByLimit(Book book, @Param("pageable") Pageable pageable);

    long count(Book book);

    int insert(Book book);

    int insertBatch(@Param("entities") List<Book> entities);

    int insertOrUpdateBatch(@Param("entities") List<Book> entities);

    int update(Book book);

    int deleteById(Integer id);

    /**
     * 测试 mybatis 一对一查询
     * @return
     */
    List<BookDto> queryList(String keyWord);
}

